import request from '@/utils/request';

export async function getInspectItemByPage(params: any) {
  return request('/api/device/getInspectItemByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addInspectItem(params: any) {
  return request('/api/device/addInspectItem', {
    method: 'POST',
    data: params,
  });
}

export async function updateInspectItem(params: any) {
  return request('/api/device/updateInspectItem', {
    method: 'POST',
    data: params,
  });
}

export async function delInspectItem(params: any) {
  return request('/api/device/delInspectItem', {
    method: 'POST',
    data: params,
  });
}
export async function addInspectFile(params: any) {
  return request('/api/device/addInspectFile', {
    method: 'POST',
    data: params,
  });
}

export async function exportInspectItem(params: any) {
  return request('/api/device/exportInspectItem', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

//file
export async function uploadInspectFile(para: any) {
  return request('/api/device/uploadInspectFile', {
    method: 'POST',
    requestType: 'form',
    data: para.file,
    headers: {
      'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryX72QZDdfwlF5U73J',
    },
    params: {
      inspectitemId: para.inspectitemId,
      memo: para.memo,
      fileName: para.fileName,
    },
  });
}

export async function delInspectFile(params: any) {
  return request('/api/device/delInspectFile', {
    method: 'POST',
    data: params,
  });
}

export async function getCheckDesc(params: any) {
  return request('/api/device/getCheckDesc', {
    method: 'POST',
    data: params,
  });
}

export async function getCheckItem(params: any) {
  return request('/api/device/getCheckItem', {
    method: 'POST',
    data: params,
  });
}

export async function exportInspectFile(params: any) {
  return request('/api/device/exportInspectFile', {
    method: 'POST',
    data: params,
  });
}

export async function getInspectFileByPage(params: any) {
  return request('/api/device/getInspectFileByPage', {
    method: 'POST',
    data: params,
  });
}

export async function generateMaintenanceInfoByInspect(params: any) {
  return request('/api/device/generateMaintenanceInfoByInspect', {
    method: 'POST',
    data: params,
  });
}

export default {
  getInspectItemByPage,
  addInspectItem,
  updateInspectItem,
  delInspectItem,
  exportInspectItem,
  uploadInspectFile,
  delInspectFile,
  exportInspectFile,
  getInspectFileByPage,
  getCheckItem,
  getCheckDesc,
  generateMaintenanceInfoByInspect,
};
